package com.zxy.supplier_system.server.service

import com.zxy.supplier_system.server.controller.DirectSaleOrderPaidRecordController
import com.zxy.supplier_system.server.repository.DirectSaleOrderPaidRecordRepository
import org.springframework.stereotype.Service

@Service
class DirectSaleOrderPaidRecordService(
    private val directSaleOrderPaidRecordRepository: DirectSaleOrderPaidRecordRepository,
    private val systemServiceService: SystemServiceService,
) {

    fun getAllPaidRecords(id: Int):List<DirectSaleOrderPaidRecordController.PaidRecordResponse> {
        return this.directSaleOrderPaidRecordRepository.findAllByOrder_IdAndOrder_Client_SystemService(id,systemServiceService.getCurrentSystemService()).map {
            DirectSaleOrderPaidRecordController.PaidRecordResponse(it.id,it.price,it.createdDateTime)
        }
    }

}
